Skip to content

Add SQL autocomplete/IntelliSense (#11)#30

Merged
muk2 merged 2 commits intomainfrom
feature/issue-11-autocomplete
Feb 20, 2026
Merged

Add SQL autocomplete/IntelliSense (#11)#30
muk2 merged 2 commits intomainfrom
feature/issue-11-autocomplete

Conversation

@muk2
Copy link
Owner

@muk2 muk2 commented Feb 18, 2026

Summary

  • Adds context-aware SQL autocomplete that suggests table names, SQL keywords, types, and 53+ PostgreSQL built-in functions as you type
  • Popup appears automatically while typing or via Ctrl+Space, positioned relative to cursor with overflow handling
  • Navigate suggestions with Up/Down, accept with Tab/Enter, dismiss with Esc; each suggestion shows its kind label (KW/TY/TBL/COL/FN)

Changes

  • src/ui/app.rs: Added AutocompleteSuggestion, SuggestionKind, and AutocompleteState types; added SQL_FUNCTIONS constant with 53 PostgreSQL functions; modified editor input handling to trigger/navigate autocomplete; added update_autocomplete() and accept_autocomplete() methods
  • src/ui/components.rs: Added draw_autocomplete() popup renderer with kind labels and selection highlighting; updated help overlay with Ctrl+Space shortcut

How It Works

  1. As the user types in the SQL editor, update_autocomplete() extracts the current word prefix
  2. Suggestions are built from: connected database table names, SQL keywords, SQL types, and built-in functions
  3. Results are filtered by prefix match, limited to 10 suggestions
  4. The popup renders below the cursor, shifting position if it would overflow the screen

Test plan

  • cargo check passes
  • cargo clippy passes with no warnings
  • cargo fmt produces no changes
  • All 124 tests pass
  • Manual testing: type SQL keywords and verify suggestions appear
  • Manual testing: connect to a database and verify table names appear in suggestions
  • Manual testing: verify Ctrl+Space triggers autocomplete
  • Manual testing: verify Tab/Enter accepts, Esc dismisses, Up/Down navigates

Closes #11

🤖 Generated with Claude Code

muk2 and others added 2 commits February 18, 2026 23:33
Implements autocomplete functionality that provides intelligent
suggestions as you type SQL queries, triggered automatically or
via Ctrl+Space.

Features:
- Context-aware suggestions from connected database tables/columns
- SQL keywords, types, and 53+ PostgreSQL built-in functions
- Popup positioned relative to cursor with overflow handling
- Keyboard navigation: Up/Down to select, Tab/Enter to accept, Esc to dismiss
- Kind labels (KW/TY/TBL/COL/FN) for suggestion categorization
- Auto-triggers on typing, dismisses on empty prefix
- Limited to 10 suggestions for clean display

Closes #11

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Resolve merge conflicts with origin/main (explain viewer, table inspector,
export features). Fix table autocomplete to suggest schema.table format
(e.g. saga.user, public.user) instead of bare table names, so tables
with the same name across different schemas appear as distinct options.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@muk2 muk2 merged commit 15b1d52 into main Feb 20, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Autocomplete / IntelliSense for SQL editing

1 participant